package subject_set.weekly_competition.day10_16;

import java.util.HashSet;
import java.util.Set;

/**
 * @author haomin
 * @date 2022/10/16 10:30
 **/
public class Num1 {
    class Solution {
        public int findMaxK(int[] nums) {
            Set<Integer> set = new HashSet<>();
            int max = Integer.MIN_VALUE;
            for(int i : nums){
                int revI = -i;
                if(set.contains(revI)) max = Math.max(max, Math.abs(revI));
                set.add(i);
            }
            return max == Integer.MIN_VALUE ? -1 : max;
        }
    }
}